package cn.dansj.common.utils.bean;

import cn.dansj.common.utils.transfer.DateTime;
import cn.dansj.common.utils.transfer.DefaultMethods;

public class PageResult<T> extends DefaultMethods {
    /**
     * 当前页码
     */
    private int pageNum;

    /**
     * 每页数量
     */
    private int pageSize;

    /**
     * 记录总数
     */
    private long totalSize;

    /**
     * 当前页记录数
     */

    private int currentSize;

    /**
     * 页码总数
     */
    private int totalPages;

    private T data;

    private boolean status = true;

    private DateTime startTime;

    private DateTime endTime;

    public PageResult() {
        setStartTime(DateTime.getInstance());
    }

    public PageResult(int pageNum, int pageSize, long totalSize, int totalPages, T data) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalSize = totalSize;
        this.totalPages = totalPages;
        this.data = data;
        setStartTime(DateTime.getInstance());
    }

    public int getPageNum() {
        return pageNum;
    }

    public PageResult<T> setPageNum(int pageNum) {
        this.pageNum = pageNum;
        return this;
    }

    public int getPageSize() {
        return pageSize;
    }

    public PageResult<T> setPageSize(int pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public long getTotalSize() {
        return totalSize;
    }

    public PageResult<T> setTotalSize(long totalSize) {
        this.totalSize = totalSize;
        return this;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public PageResult<T> setTotalPages(int totalPages) {
        this.totalPages = totalPages;
        return this;
    }

    public T getData() {
        return data;
    }

    public PageResult<T> setData(T data) {
        this.data = data;
        return this;
    }

    public boolean isStatus() {
        return status;
    }

    public PageResult<T> setStatus(boolean status) {
        this.status = status;
        return this;
    }

    public DateTime getStartTime() {
        return startTime == null ? DateTime.getInstance() : startTime;
    }

    public PageResult<T> setStartTime(DateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    public DateTime getEndTime() {
        return endTime == null ? DateTime.getInstance() : endTime;
    }

    public PageResult<T> setEndTime(DateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    public PageResult<T> setEndTime() {
        return setEndTime(DateTime.getInstance());
    }

    public int getCurrentSize() {
        return currentSize;
    }

    public PageResult<T> setCurrentSize(int currentSize) {
        this.currentSize = currentSize;
        return this;
    }
}
